package bsc.ejb.entity;

import bsc.ejb.metadata.Comparation;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

/**
 *
 * @author memozac
 */
@Entity
public class Comparator implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idComparator;

    @Column(columnDefinition="text")
    private String description;

    @ManyToOne
    private Comparation comparation;
    @ManyToOne
    private Pointer pointer;
    @OneToOne
    private Settings settings;

    @ManyToMany(targetEntity=DimensionalCut.class)
    @JoinTable(name="ComparatorDimensionalCut",
    joinColumns=@JoinColumn(name="idComparator"),
    inverseJoinColumns=@JoinColumn(name="idScoreCard"))
    private Collection<DimensionalCut> dimensionalCuts;

    public Comparation getComparation() {
        return comparation;
    }

    public void setComparation(Comparation comparation) {
        this.comparation = comparation;
    }

    public Settings getSettings() {
        return settings;
    }

    public void setSettings(Settings settings) {
        this.settings = settings;
    }

    public Collection<DimensionalCut> getDimensionalCuts() {
        return dimensionalCuts;
    }

    public void setDimensionalCuts(Collection<DimensionalCut> dimensionalCuts) {
        this.dimensionalCuts = dimensionalCuts;
    }

    public Pointer getPointer() {
        return pointer;
    }

    public void setPointer(Pointer pointer) {
        this.pointer = pointer;
    }

    public Long getIdComparator() {
        return idComparator;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idComparator != null ? idComparator.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Comparator)) {
            return false;
        }
        Comparator other = (Comparator) object;
        if ((this.idComparator == null && other.idComparator != null) || (this.idComparator != null && !this.idComparator.equals(other.idComparator))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bsc.ejb.entity.Comparator[id=" + idComparator + "]";
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

}//ends of class
